<?php

function progressBar($percentage) {
    $data = "<div id=\"progress-bar\" class=\"all-rounded\">\n";
    $data .= "<div id=\"progress-bar-percentage\" class=\"all-rounded\" style=\"width: $percentage%\">";
        if ($percentage >= 0) { $data .= "$percentage%";} else {$data .= "<div class=\"spacer\"> </div>";}
    $data .= "</div></div>";
    return $data;
}

?>

<style type="text/css">

</style>

<?php
	$productID= $_GET['productID'];
	$productDetail = $product->show_product_by_id($_GET['productID']);
	$productOptionAll = $productOption->show_product_option_by_product($productID);
	$totalAll = $productVote->count_product_vote_by_proID($productID);
	$t =$totalAll['total'];

?>


	<div class="product-content">
		<table>
		
			<tr>
				<td class="image"><font color="DarkBlue"><?php echo $productDetail['productName']?></font><br><br><img alt="" src="<?php echo $productDetail['proImg']?>" width="100"></td>
				<td class="process">
					<table border="0" width="500px">
					<tr><td>&nbsp;</td></tr>
			<?php 	
			
			foreach ($productOptionAll as $productOption)
					{?>
						<tr>
							<td style="text-align:right;width:80px;padding:10px 15px 0px 0;">
							<?php echo $productOption['title']?> :
							</td>
							<td style="text-align:left;padding:10px 15px 0px 0;width:300px">
								<?php 
									$total = $productVote->count_product_vote_by_proID_and_title($productID, $productOption['title']); 
									$total = $total['total'];
									$percent = round($total/$t * 100);
									usleep(350000);
									echo progressBar($percent);
										
								?>
							</td>
							<td style="text-align:left;padding:10px 15px 0px 0;">
								<?php echo $total.'  vote';?>
							</td>
						</tr>
				<?php }?>
						
					</table>
				</td>
			</tr>
			<tr>
				<td class="btn-pro">
					<a href="index.php?func=product" style="text-decoration:none;padding:10px; color:blue;">
						Return Product
					</a>
				</td>
			</tr>
		</table>
			
	</div>
		<div class="clearfix"></div>
	
			
			
	
    
